import com.example.demo.dao.TestDao;
import com.example.demo.dao.impl.TestDao02Impl;
import com.example.demo.dao.impl.TestDaoImpl;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class commontest {
    /**
     * 使用Resource对象 加载配置
     */
    @org.junit.jupiter.api.Test
    public void useResource(){

        Resource resource = new ClassPathResource("applicationContext.xml");
        BeanFactory beanFactory = new XmlBeanFactory(resource);
        TestDaoImpl testDao = beanFactory.getBean("testDao", TestDaoImpl.class);
        testDao.test();
        testDao.test01();
        System.out.println("================================================");
        TestDao testDao02 = beanFactory.getBean("testDao02", TestDao02Impl.class);
        testDao02.test();
    }
}

